%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
weekstr=[];
for ww=1:1:numel(Ivec)
    weekstr=[weekstr {['Week ',num2str(ww)]}];
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%KEY FIGURE: EFFECTS OF EPI+CONTAINMENT ON YOUNG AND OLD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
conflevel=0.95;
factor=-norminv((1-conflevel)/2);

figure;
sub1=subplot(1,1,1);

plot((1:1:14),tty_data.Consy_data,'b--','LineWidth',2); hold on %data mean young

grpyat = [ (1:1:14)' (tty_data.Consy_data(1:end)-factor*100*par.dat_stderr_young(1:end)'); (14:-1:1)' (tty_data.Consy_data(end:-1:1))+factor*100*par.dat_stderr_young(end:-1:1)'];
patch(grpyat(:,1),grpyat(:,2),[0.8 0.8 1],'edgecolor',[0.8 0.8 1]); hold on %data 95% young
%use uisetcolor to get RBG codes

plot((1:1:14),cons_monthly.Cy.Consy(1:end-1),'b-','LineWidth',2); hold on %model young

plot((1:1:14),tto_data.Conso_data,'r--','LineWidth',2);%data mean old

grpyat = [ (1:1:14)' (tto_data.Conso_data(1:end)-factor*100*par.dat_stderr_old(1:end)'); (14:-1:1)' (tto_data.Conso_data(end:-1:1))+factor*100*par.dat_stderr_old(end:-1:1)'];
patch(grpyat(:,1),grpyat(:,2),[1 0.8 0.8],'edgecolor',[1 0.8 0.8]); hold on%data 95% old

plot((1:1:14),cons_monthly.Co.Conso(1:end-1),'r-','LineWidth',2); hold on%model old

plot((1:1:14),tty_data.Consy_data,'b--','LineWidth',2); hold on %data mean young
plot((1:1:14),cons_monthly.Cy.Consy(1:end-1),'b-','LineWidth',2); hold on %model young
plot((1:1:14),tto_data.Conso_data,'r--','LineWidth',2);%data mean old

plot((1:1:14),0*tto_data.Conso_data,'k:','LineWidth',1.5);
titl=title('Consumption of Young and Old in the Pandemic','FontSize',12);
legend1=legend('Data: Young (Mean)','Data: Young (95%)', 'Model: Young', 'Data: Old (Mean)','Data: Old (95%)', 'Model: Old','Location','Southwest','FontSize',12);
box off;
legend box off;
ylabel('% deviations from no epidemic baseline','FontSize',12);
set(legend1,...
    'Position',[0.317548452641451 0.250788781770377 0.264285714285714 0.229761904761905],...
    'Orientation','vertical');
sub1.XLim(1)=1;%'01-Mar-2020';
sub1.XLim(2)=14;%'01-Mar-2021';
sub1.YLim(1)=-50;
sub1.YLim(2)=15;

datstring=['Mar 2020'
    'Apr 2020'
    'May 2020'
    'Jun 2020'
    'Jul 2020'
    'Aug 2020'
    'Sep 2020'
    'Oct 2020'
    'Nov 2020'
    'Dec 2020'
    'Jan 2021'
    'Feb 2021'
    'Mar 2021'
    'Apr 2021'];

%xticks(cons_monthly.Cy.Time(1:end-1));
xticks(1:14);
%xticklabels({cons_monthly.Cy.Time(1:end-1)});
xticklabels(datstring)
xtickangle(-35);
set(gca,'FontSize',12);
set(titl,'FontSize',18);

orient landscape
print -dpdf -fillpage cons_young_old_epidemic


%print out results
disp(' ');

disp('Model vs. Data Consumption (in percent of no-epi baseline)');

%young, data 
%first wave
young_first_data=min(tty_data.Consy_data(1:7))
%second wage
young_second_data=min(tty_data.Consy_data(8:end))

%young, model
%first wave
young_first_model=min(cons_monthly.Cy.Consy(1:7))
%second wave
young_second_model=min(cons_monthly.Cy.Consy(8:end))

%old, data 
%first wave
old_first_data=min(tto_data.Conso_data(1:7))
%second wage
old_second_data=min(tto_data.Conso_data(8:end))


%old, model
%first wave
old_first_model=min(cons_monthly.Co.Conso(1:7))
%second wave
old_second_model=min(cons_monthly.Co.Conso(8:end))
